package com.zjk.config;

import com.zjk.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    /**
     * 配置拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                /*添加拦截的路径*/
                .addPathPatterns("/admin/**")
                /*排除拦截的路径*/
                .excludePathPatterns("/admin", "/admin/login", "/admin/register/**", "/admin/captcha",
                        "/static/**", "/css/**", "/img/**", "/logo/**", "/upload/**", "/js/**", "/lib/**");
    }
}
